package cn.eng.basic.controller;

import cn.eng.basic.domain.dto.PhoneRegisterDto;
import cn.eng.basic.service.IVerifyCodeService;
import cn.eng.basic.utils.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService verifyCodeService;

    /**
     * 获取图形验证码
     * @param imageCodekey
     * @return
     */
    @GetMapping("/image/{imageCodekey}")
    public String getVerifyCode(@PathVariable("imageCodekey") String imageCodekey){
        return verifyCodeService.getVerifyCode(imageCodekey);
    }
    @PostMapping("/smsCode")
    public AjaxResult getSmsCode(@RequestBody PhoneRegisterDto phoneRegisterDto){
        verifyCodeService.getSmsCode(phoneRegisterDto);
        return AjaxResult.me();
    }
    /**
     * 微信绑定获取手机验证码
     */
    @PostMapping("/binderSmsCode")
    public AjaxResult getBinderSmsCode(@RequestBody Map<String,String> map){
         verifyCodeService.getBinderSmsCode(map);
         return AjaxResult.me();
    }

}
